import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "book03.settings")
import django
django.setup()
from books.serializer import BookModelSerializer

from books.models import BookInfo

if __name__ == '__main__':
    pass

    # book = BookInfo.objects.get(id=3)
    # serializer = BookSerializer(instance=book, many=False)
    #
    # print(serializer.data)

    # hero = HeroInfo.objects.get(id=5)
    #
    # serializer = HeroSerializer(instance=hero)
    #
    # print(serializer.data)

    # book_dict = {
    #     'btitle': '金瓶梅',
    #     'bpub_date': '1990-11-12',
    #     'bread': 50,
    #     'bcomment': 20,
    # }
    #
    # serializer = BookSerializer(instance=BookInfo.objects.get(btitle='西游记'), data=book_dict, )
    #
    # print(serializer.is_valid(raise_exception=True))
    #
    # book = serializer.save()
    # print(book,type(book))

    # print(BookModelSerializer())